<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn" href="{:U('addInstitution')}">新 增</a>
        </div>

        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" class="search-input" name="name" value="{:I('name')}" placeholder="请输入机构名称">
                <input type="text" class="search-input" name="mobile" value="{:I('mobile')}" placeholder="请输入负责人手机号" style="margin-right: 10px;">
                <select name="status" style="margin-right: 10px;">
                    <option value="-1">请选择审核状态</option>
                    <option value="0">待审核</option>
                    <option value="1">审核成功</option>
                    <option value="2">审核失败</option>
                </select>
            </div>
            <a class="sch-btn" href="javascript:;" id="search" url="{:U('institutionList')}"><i class="btn-search"></i></a>
        </div>

    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table>
            <thead>
            <tr>
                <th>ID</th>
                <th>机构名称</th>
                <th>负责人姓名</th>
                <th>负责人电话</th>
                <th>机构二维码</th>
                <th>审核状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.name}</td>
                        <td>{$vo.username}</td>
                        <td>{$vo.mobile}</td>
                        <td><if condition="$vo['qr']"><img src="{$vo.qr|getPicture}" width="100px" height="100px" /><else />暂无机构二维码</if></td>
                        <td>{$vo.status|doInstitutionStatus}</td>
                        <td>
                            <a href="{:U('institutionDetail',array('id'=>$vo['id']))}" class="authorize">查看详情</a>
                            <!--<a href="{:U('delInstitution',array('id'=>$vo['id']))}" class="authorize">删除</a>-->
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">
        //搜索功能
        $('#search').click(function(){
            var url = $(this).attr('url').replace('.html', '');
            var query  = $('.search-form').find('input').serialize();
            var squery = $('.search-form').find('select').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            squery=squery.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            squery=squery.replace(/^&/g,'');
            if( url.indexOf('?')>0 ){
                url += '&' + query+'&'+squery;
            }else{
                url += '?' + query+'&'+squery;
            }
            window.location.href = url;
        });


        //导航高亮
        highlight_subnav('{:U("Manage/institutionList")}');
    </script>
</block>